<?php
namespace app\common\validate;

use think\Validate;

class Category extends Validate
{
    protected $rule = [
        'name'      =>  'require|unique:category',
        'flag'      =>  'require|unique:category',
        'status'    =>  'require|in:0,1',

    ];
    protected $message = [
        'name.require'      =>  '栏目名必填',
        'name.unqiue'       =>  '栏目名已存在',
        'flag.require'      =>  '标识名必填',
        'flag.unqiue'       =>  '标识名已存在',
        'status.require'    =>  '显示状态必选',
        'status.in'         =>  '显示状态参数错误',
    ];
    protected $scene = [
        'insert'=>['name','flag','status'],
        'update'=>['name','flag'],
        'status'=>['status'],
    ];
}
